package service;

import java.util.List;

import com.fasterxml.jackson.core.JsonProcessingException;

import pojo.Area;
import util.JsonUtil;
import dao.AreaDao;
import dao.AreaDaoImpl;

public class AreaManagerImpl implements AreaManager {

	private AreaDao ad;
	public AreaManagerImpl(){
		this.ad=new AreaDaoImpl();
	}
	public List<Area> findFiveAreasByName(String name) {
		List<Area> al = ad.findFiveAreasByName(name);
		return al;
	}
	public String findFiveAreasByNameToJson(String name) {
		String jsonStr = null; 
		List<Area> al = ad.findFiveAreasByName(name);
		try {
			jsonStr = JsonUtil.areasToJson(al);
		} catch (JsonProcessingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return jsonStr;
	}
	
}
